package Tree116;
import java.util.*;

//将二叉树镜像
public class MirrorTree {
    static class TreeNode {
    int val = 0;
    TreeNode left = null;
    TreeNode right = null;
    public TreeNode(int val) {
      this.val = val;
    }
 }
    public TreeNode Mirror (TreeNode pRoot) {
        if(pRoot==null){
            return pRoot;
        }
        TreeNode cur=pRoot;
        TreeNode cur3=new TreeNode(cur.val);//递归实现
        cur3.left=Mirror(cur.right);//左右节点交换
        cur3.right=Mirror(cur.left);
        return cur3;
    }


}
